#include "stdafx.h"
#include "CGraphicMgr.h"
#include "CBookMarkListStatu.h"
#include "CEbook.h"
CBookMarkListStatu::CBookMarkListStatu(WCHAR* name):IStatu(name)
{
}

CBookMarkListStatu::~CBookMarkListStatu(void)
{
}
bool CBookMarkListStatu::EnterStatu()
{
	CListCtrl* p = (CListCtrl*)GRAPHICMGR.GetElement(L"listCtrl_bookmark");
	if (p)
	{
		//GlobalStatic::loadLanguage(p->m_mapFileName);

        
		CEbook*pEbook = (CEbook*)GRAPHICMGR.GetElement(L"bookshow_screen");
		int nCount;
		TCHAR tcText[MAX_PATH];
		TCHAR cText[MAX_PATH];
		int nPercent;
		wstring strText;
		wstring strTmp;
		nCount = pEbook->GetListBMCount();

		GlobalStatic::vec_listview_items.clear();
	
		for(int i=0; i<nCount && nCount>0; i++)
		{
			memset(cText,0,sizeof(TCHAR)*MAX_PATH);
			pEbook->GetBMText(i,cText,nPercent);	

			memset(tcText,0,sizeof(TCHAR)*MAX_PATH);
			swprintf(tcText,L" %d%%",nPercent);
			strText = tcText;
			memset(tcText,0,sizeof(TCHAR)*MAX_PATH);
			swprintf(tcText,L"%s",cText);
			strTmp = tcText;

			GlobalStatic::vec_listview_items.push_back(intstrpair(COMMON_TYPE, strTmp));
			 p->m_mapFileName.insert(strstrpair(strTmp,strTmp));
		}
		

		p->constructMap();
	}
	return true;

}
bool CBookMarkListStatu::ExitStatu()
{
	return true;
}
bool CBookMarkListStatu::EvaluateClickEvent(const WCHAR* elementName)
{
	
	return false;
}
